
"****View settings****

syntax on
set background=dark
set mouse=v
set number
set hlsearch
set incsearch
set ignorecase
set wrap
set ruler

filetype on
filetype plugin on
"filetype indent on

nmap <C-N> :if empty(&number) <Bar> set nu <Bar> else <Bar> set nonu <Bar> endif <CR>
nmap <F9> :if empty(&ignorecase) <Bar> set ignorecase <Bar> else <Bar> set noignorecase<Bar> endif <CR><ESC>
nmap <F10> :if empty(&wrap) <Bar> set wrap <Bar> else <Bar> set nowrap <Bar> endif <CR><ESC>

"Resize/move sub windows
nmap _ :execute "normal 1<Bslash><lt>C-W>-"<CR>
nmap + :execute "normal 1<Bslash><lt>C-W>+"<CR>
nmap < :execute "normal 1<Bslash><lt>C-W><lt>"<CR>
nmap > :execute "normal 1<Bslash><lt>C-W>>"<CR>

"Remember the line when close a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif

"****Edit settings****

set expandtab
set tabstop=2
set shiftwidth=2
set wildmode=longest,longest,full
set wildmenu
"set autoindent
"set smartindent

let hexmode=0
nmap <C-X> :if hexmode==0 <Bar>
		\     execute '%!xxd'<Bar>
		\     let hexmode=1<Bar>
		\ else<Bar>
		\     execute '%!xxd -r'<Bar>
		\     let hexmode=0<Bar>
		\ endif<CR><ESC>

nmap <C-C><C-N> :tabnew<CR>

"plugin: NERD_tree
nmap <F2> :NERDTreeToggle<CR>

"plugin: tagbar
nmap <F3> :TagbarToggle<CR>

"plugin: NERD_commenter
nnoremap <F4> :call NERDComment(0, "norm")<CR>
vnoremap <F4> :call NERDComment(1, "norm")<CR>
nnoremap <F5> :call NERDComment(0, "uncomment")<CR>
vnoremap <F5> :call NERDComment(1, "uncomment")<CR>

"plugin: ctags
"let g:ctags_path='/home/van/Develop/test/tags'
"let g:ctags_statusline=1
"let generate_tags=1	      " To start automatically when a supported

"encoding
set fileencodings=utf-8
set fileencoding=utf-8
set encoding=utf-8

